//引入VueRouter
import VueRouter from 'vue-router'

//创建router实例对象，去管理一组一组的路由规则
const router = new VueRouter({
    routes: [{
            path: '/',
            name: 'Home',
            component: () =>
                import ('@/pages/home/Home')
        },
        {
            path: '/city',
            name: 'City',
            component: () =>
                import ('@/pages/city/City')
        },
        {
            path: '/detail/:id',
            name: 'Detail',
            component: () =>
                import ('@/pages/detail/Detail')
        }

    ],
    // 滚动行为 页面切换回到顶部
    scrollBehavior(to, from, savedPosition) {
        return { x: 0, y: 0 }
    }
})

export default router